# Maintainer:  Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

pkgname=gdbm
pkgver=1.18
pkgrel=1
pkgdesc='GNU database library'
url='http://www.gnu.org/software/gdbm/gdbm.html'
license=(GPL3)
arch=(x86_64)
depends=(glibc sh)
source=(http://ftp.gnu.org/gnu/gdbm/${pkgname}-${pkgver}.tar.gz{,.sig})
validpgpkeys=('325F650C4C2B6AD58807327A3602B07F55D0C732')
md5sums=('e316f8e4a3e7e4f23955be65d54fec48'
         'SKIP')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --enable-libgdbm-compat
  make
}

check() {
  cd $pkgname-$pkgver
  make check
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  # create symlinks for compatibility
  install -dm755 "$pkgdir/usr/include/gdbm"
  ln -sf ../gdbm.h "$pkgdir/usr/include/gdbm/gdbm.h"
  ln -sf ../ndbm.h "$pkgdir/usr/include/gdbm/ndbm.h"
  ln -sf ../dbm.h  "$pkgdir/usr/include/gdbm/dbm.h"
}
